package demo.generator;

import java.util.ResourceBundle;

import com.baomidou.mybatisplus.generator.config.GlobalConfig;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;

import net.oschina.renyong.query.generator.QuerySqlGenerator;

public class DemoMysqlQueryDeleter {

	// 从properties中获取项目配置信息
	private static final ResourceBundle rb = ResourceBundle.getBundle("mp_generator");

	// 目标项目根路径
	private static final String PROJECT_DIR = rb.getString("mpg.project_dir");
	// 目标项目的基础包名
	private static final String PROJECT_PACKAGE = rb.getString("mpg.project_package");

	public static void main(String[] args) {
		String[] configNameArr = { "vm_modbus_point_collect_rule" };

		// 全局配置
		GlobalConfig globalConfig = new GlobalConfig();
		globalConfig.setOutputDir(PROJECT_DIR);

		// 包 配置
		PackageConfig packageConfig = new PackageConfig();
		packageConfig.setParent(PROJECT_PACKAGE);

		QuerySqlGenerator generator = new QuerySqlGenerator();
		generator.setGlobalConfig(globalConfig);
		generator.setPackageConfig(packageConfig);
		// 表名生成策略
		generator.setNamingStrategy(NamingStrategy.underline_to_camel);

		generator.executeDelete(configNameArr);
	}
}
